<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'competency-library-form',
	'enableAjaxValidation'=>true,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'COMP_LIB_CODE'); ?>
		<?php echo $form->textField($model,'COMP_LIB_CODE',array('size'=>10,'maxlength'=>10)); ?> *
		<?php echo $form->error($model,'COMP_LIB_CODE'); ?>
	</div>
<!--	form autocomplete
	<div class="row">
	<?php
	
		echo $form->labelEx($model, 'COMP_ELEM_CODE');
		 $this->widget('EJuiAutoCompleteFkField', array(
			  'model'=>$model, 
			  'attribute'=>'COMP_ELEM_CODE', //the FK field (from CJuiInputWidget)
			  // controller method to return the autoComplete data (from CJuiAutoComplete)
			  'sourceUrl'=>Yii::app()->createUrl('/competencyLibrary/findElementId'), 
			  // defaults to false.  set 'true' to display the FK field with 'readonly' attribute.
			  'showFKField'=>true,
			   // display size of the FK field.  only matters if not hidden.  defaults to 10
			  'FKFieldSize'=>15, 
			  'relName'=>'competencyElement', // the relation name defined above
			  'displayAttr'=>'ElementCodeAndUnit',  // attribute or pseudo-attribute to display
			  // length of the AutoComplete/display field, defaults to 50
			  'autoCompleteLength'=>60,
			  // any attributes of CJuiAutoComplete and jQuery JUI AutoComplete widget may 
			  // also be defined.  read the code and docs for all options
			  'options'=>array(
				  // number of characters that must be typed before 
				  // autoCompleter returns a value, defaults to 2
				  'minLength'=>3, 
			  ),
		 ));
		echo $form->error($model, 'COMP_ELEM_CODE');
	?>
	</div>
-->	
<?php

echo $form->dropDownList($model,'COMP_UNIT_CODE',$model->getUnitId(),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('competencyLibrary/dynamicElement'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'update'=>'#'.CHtml::activeId($model,'COMP_ELEM_CODE'), //selector to update '#COMP_ELEM_CODE' 'update'=>'#'.CHtml::activeId($model,'COMP_ELEM_CODE') 
//'data'=>'js:javascript statement'  '#'.CHtml::activeId($model, 'province_reference_id')
//leave out the data key to pass all form values through
)));
?>


<div class="row">
		<?php echo $form->labelEx($model,'COMP_ELEM_CODE'); ?>
		<?php echo $form->dropDownList($model,'COMP_ELEM_CODE',array()); ?>
		<?php echo $form->error($model,'COMP_ELEM_CODE'); ?>
</div>
	
	
<!--
	<div class="row">
		<?php echo $form->labelEx($model,'COMP_ELEM_CODE'); ?>
		<?php echo $form->textField($model,'COMP_ELEM_CODE',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'COMP_ELEM_CODE'); ?>
	</div>-->

	<div class="row">
		<?php echo $form->labelEx($model,'COMP_LIB_NAME'); ?>
		<?php echo $form->textField($model,'COMP_LIB_NAME',array('size'=>60,'maxlength'=>200)); ?> *
		<?php echo $form->error($model,'COMP_LIB_NAME'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'COMP_LIB_DESC'); ?>
		<?php echo $form->textArea($model,'COMP_LIB_DESC',array('size'=>60,'maxlength'=>1000)); ?>
		<?php echo $form->error($model,'COMP_LIB_DESC'); ?>
	</div>
<!--
	<div class="row">
		<?php echo $form->labelEx($model,'TIME_CREATED'); ?>
		<?php echo $form->textField($model,'TIME_CREATED'); ?>
		<?php echo $form->error($model,'TIME_CREATED'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'TIME_UPDATED'); ?>
		<?php echo $form->textField($model,'TIME_UPDATED'); ?>
		<?php echo $form->error($model,'TIME_UPDATED'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'USER_CREATED'); ?>
		<?php echo $form->textField($model,'USER_CREATED'); ?>
		<?php echo $form->error($model,'USER_CREATED'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'USER_UPDATED'); ?>
		<?php echo $form->textField($model,'USER_UPDATED'); ?>
		<?php echo $form->error($model,'USER_UPDATED'); ?>
	</div>-->

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
